interface IChao {
    name: string,
    age: number,
    slogan?: string
}

type IC = Record<keyof IChao, IChao>

const obj: IC = {
    name: {
        name: "123",
        age: 12,
    },
    age: {
        name: "123",
        age: 12,
    },
    slogan: {
        name: "123",
        age: 12,
        slogan: "2321"
    },
}

type Ref = keyof any // 相当于 string | number | symbol
// 要确保 Keys一定是可以作为key的联合类型
type MyRecord<Keys extends keyof any, T> = {
    // in 遍历联合类型
    [P in Keys]: T
}

type t1 = "洛杉矶" | "浙江" | "江苏"
type IC2 = MyRecord<t1, IChao>

const obj2: IC2 = {
    "洛杉矶": {
        name: "123",
        age: 12,
    }, "浙江": {
        name: "123",
        age: 12,
    }, "江苏": {
        name: "123",
        age: 12,
    }
}

export { }